perm filename MFF20.SAI[MF,DEK]3 blob
sn#601689 filedate 1981-07-21 generic text, type T, neo UTF8
comment This page contains the most TOPS20-dependent aspects
of the METAFONT input routines for TOPS20 installations. It
is "included" by MFNTRP;
internal saf string array fname[0:2] # file directory, name, and extension;
internal simp procedure scanfilename # sets up fname[0:2];
begin integer j,c,cc;
fname[0]←fname[1]←fname[2]←"";
j←1;
while curbuf and chartype[curbuf]=space do c←lop(curbuf);
loop begin cc←chartype[c←lop(curbuf)];
if c="." and j=1 then j←2
else if c="<" and j=1 and fname[1]="" then j←0
else if (c=">" and j=0) or (c=":" and j=1) then begin end
else begin
case cc of begin
[wxy][digit][letter] ;
else done end;
end;
fname[j]←fname[j]&c;
if c=">" and j=0 then j←1
else if c=":" and j=1 then begin fname[0]←fname[1]; fname[1]←""; end
end;
end;
procedure inputfile;
begin comment "input" has just been scanned. This procedure scans
the user's file name, employing the TENEX naming conventions, then reads
in the first line and feeds it to the input system;
integer chan;
label abort # if something goes wrong trying to read the file;
label try # go here to try and try again;
string flname;
integer pageno # number of pages successfully read;
define checkeof=⊂if eof then begin print(")");go to abort end⊃;
try: scanfilename;
if noinput then return;
if fname[2]="" then fname[2]←".mf" # default extension;
flname←fname[0]&fname[1]&fname[2];
chan←openfile(flname,"RE");
if chan<0 and fname[0]="" then
begin comment if lookup failed and no explicit directory was given,
try default directory <TEX.FONTS>;
flname←"PS:<TEX.FONTS>"&flname;
chan←openfile(flname,"RE");
end;
if chan<0 then
begin error("Lookup failed on file "&flname);
go to try;
end;
print(" (",flname);
setinput(chan,4000,brchar,eof);
pushinput # save present file status;
recovery←chan; filename←flname;
inbuf←input(chan,crffbreak) # get first line of file;
# DRF ; IF EOF AND LENGTH(INBUF)>0 THEN BEGIN
INBUF←INBUF&'15 # PUT IN DUMMY CR ON INPUT;
BRCHAR←'15 # CONVINCE CODE BELOW ABOUT IT;
EOF←0 # CATCH IT NEXT TIME;
END;
checkeof; print(" 1");
if equ(inbuf[1 to 9],"COMMENT ⊗") then
begin comment Skip TVedit directory page;
while brchar≠'14 and not eof do inbuf←input(chan,ffbreak);
checkeof;
inbuf←input(chan,crffbreak) # get first line of second page;
checkeof; print(" 2");
pageno←2;
end
else pageno←1;
while brchar='14 do
begin comment Ignore empty pages at the beginning of file;
inbuf←input(chan,crffbreak); checkeof; pageno←pageno+1;
print(" ",pageno);
end;
loc ← (pageno lsh infod) + 1 # line 1 of the current page;
if pausing then
begin integer p # garbage bin;
if inbuf='12 then p←lop(inbuf);
if length(inbuf)=1 then inbuf←" "&inbuf;
print(nextline);
outstr(inbuf[1 to ∞-1]) # show inbuf on screen;
begin string s; s←inchwl;
if s then inbuf←s&inbuf[∞ to ∞];
end;
end;
curbuf←inbuf;
comment Now define the output file name if it hasn't yet been defined;
if ofilname=0 then
begin ofilname←fname[1]; comment ofilarea←fname[0];
end;
return;
abort: release(chan);
popinput;
end;